package com.healthbox.resultsservice.controller;

import com.healthbox.resultsservice.entity.CommonResult;
import com.healthbox.resultsservice.service.UserResultsService;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RequestMapping("/user")
@RestController
@Api(tags="用户核酸服务")
public class UserResultsController {

    @Resource
    UserResultsService userResultsService;

    /* 用户查看核酸检测结果 */
    @ApiOperation(value="用户查看核酸检测结果")
    @GetMapping(value = "/hospitalResult")
    public CommonResult readResults(
            @RequestHeader(value = "user-phone") String userPhone,
            @RequestHeader(value = "user-role") String userRole
            // user   system_admin   organ_admin
            ){
        return userResultsService.readResults(userPhone, userRole);
    }

    /* 用户查看公告 */
    @ApiOperation(value="用户查看公告")
    @PostMapping(value = "/hospitalNotice")
    public CommonResult readNotices(
            @RequestBody Map<String,Object> map,
            @RequestHeader(value = "user-phone") String userPhone,
            @RequestHeader(value = "user-role") String userRole
            ){
        return userResultsService.readNotices(map, userPhone, userRole);
    }

    /* 用户查看地区 */
    @ApiOperation(value="用户查看地区")
    @GetMapping(value = "/hospitalRegion")
    public CommonResult readRegions(
            @RequestHeader(value = "user-phone") String userPhone,
            @RequestHeader(value = "user-role") String userRole
    ){
        return userResultsService.readRegions(userPhone, userRole);
    }

}
